package com.slz3.business.module.goodsManagement.gooBaseGoodsAttribute.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.goodsManagement.gooBaseGoodsAttribute.domain.GooBaseGoodsAttribute;
import com.slz3.business.module.goodsManagement.gooBaseGoodsAttribute.domain.GooBaseGoodsAttributeCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class GooBaseGoodsAttributeResController {

    @Resource
    private GooBaseGoodsAttributeResAtomic gooBaseGoodsAttributeResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, GooBaseGoodsAttribute gooBaseGoodsAttribute) {
        if (GooBaseGoodsAttributeResUnsafeValid.add(req, gooBaseGoodsAttribute)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.add_$GooBaseGoodsAttributeUpdateLock(req, gooBaseGoodsAttribute);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, GooBaseGoodsAttributeCondition gooBaseGoodsAttributeCondition) {
        if (GooBaseGoodsAttributeResUnsafeValid.delete(req, gooBaseGoodsAttributeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.delete_$GooBaseGoodsAttributeUpdateLock(req, gooBaseGoodsAttributeCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, GooBaseGoodsAttribute gooBaseGoodsAttribute) {
        if (GooBaseGoodsAttributeResUnsafeValid.modify(req, gooBaseGoodsAttribute)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.modify_$GooBaseGoodsAttributeUpdateLock(req, gooBaseGoodsAttribute);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (GooBaseGoodsAttributeResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return GooBaseGoodsAttributeResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return gooBaseGoodsAttributeResAtomic.info_$GooBaseGoodsAttributeUpdateLock(req);
        if (GooBaseGoodsAttributeResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.info_$GooBaseGoodsAttributeUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (GooBaseGoodsAttributeResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return GooBaseGoodsAttributeResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, GooBaseGoodsAttributeCondition gooBaseGoodsAttributeCondition) {
        //
        if (GooBaseGoodsAttributeResUnsafeValid.auditSubmit(req, gooBaseGoodsAttributeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.auditSubmit_$GooBaseGoodsAttributeUpdateLock(req, gooBaseGoodsAttributeCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, GooBaseGoodsAttributeCondition gooBaseGoodsAttributeCondition) {
        if (GooBaseGoodsAttributeResUnsafeValid.audit(req, gooBaseGoodsAttributeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.audit_$GooBaseGoodsAttributeUpdateLock(req, gooBaseGoodsAttributeCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, GooBaseGoodsAttributeCondition gooBaseGoodsAttributeCondition) {
        if (GooBaseGoodsAttributeResUnsafeValid.auditReject(req, gooBaseGoodsAttributeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.auditReject_$GooBaseGoodsAttributeUpdateLock(req, gooBaseGoodsAttributeCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, GooBaseGoodsAttributeCondition gooBaseGoodsAttributeCondition) {
        if (GooBaseGoodsAttributeResUnsafeValid.usingEnable(req, gooBaseGoodsAttributeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.usingEnable_$GooBaseGoodsAttributeUpdateLock(req, gooBaseGoodsAttributeCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, GooBaseGoodsAttributeCondition gooBaseGoodsAttributeCondition) {
        if (GooBaseGoodsAttributeResUnsafeValid.usingDisable(req, gooBaseGoodsAttributeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooBaseGoodsAttributeResAtomic.usingDisable_$GooBaseGoodsAttributeUpdateLock(req, gooBaseGoodsAttributeCondition);
        }
    }

}
